HTMLViewer Class
Renders HTML and provides basic navigation features.
More information available in parent classes: RectControl:Control:Object
Example
To implement a simple web browser, create a window with a large HTMLViewer control. Set its LockLeft, LockTop, LockRight, and LockBottom properties so that it resizes as the user resizes the window. Use an EditField as the URL entry area and a PushButton as the browser's Go button. That is, the user clicks Go to display the URL entered into the EditField.
In this example, the HTMLViewer is named "HTML". The following code is in the Action event of the PushButton:
You can use a ProgressBar to indicate that the web page is loading. In the HTMLViewer's DocumentBegin event, initialize and show the ProgressBar with the code:
In the DocumentProgressChanged event, increment the value of the ProgressBar. This event handler is passed the value of PercentageComplete (0 to 100).
ProgressBar1.Maximum = 0 //display indeterminate progress
Else
ProgressBar1.Maximum = 100
End if
ProgressBar1.Value = percentageComplete
In the Document Complete event handler, hide the ProgressBar with the line:
When the title of the web page has been received, you can display it in the window's Title bar using the HTMLViewer's TitleChanged event. It is passed the new title in the String parameter newTitle. Update the window title with the line:
Use a second EditField to display the status of the load process. In the HTMLViewer's StatusChanged event handler, set the value of this EditField. This event handler is passed the current status in the String parameter, NewStatus. Display this string with the following line in the StatusChanged event:
If a new browser window is supposed to open, you need to insert some code to handle this event. For example, the user clicks a link that is supposed to display the new page in another window. Use the NewWindow event handler to create the window. The following code assumes that the browser is contained in a window called MainWindow.